//
//  LoginModel.swift
//  Exam-iOS
//
//  Created by 李胜锋 on 2018/2/26.
//  Copyright © 2018年 李胜锋. All rights reserved.
//

import Foundation
import RxSwift
import RxCocoa

enum LoginResult {
    case invalidatedMobile
    case invalidatedPassword
    case success
    case failure
    
    var description: String {
        switch self {
        case .invalidatedMobile:
            return "无效的手机号"
            
        case .invalidatedPassword:
            return "无效的密码"
            
        case .success:
            return "登陆成功"
            
        case .failure:
            return "登录失败"
      
        }
    }
}


protocol ValidatedModelType {
    func validatedMobile(_ mobile: String) -> Bool
    func validatePassword(_ password:String) -> Bool
    func login(_ mobile:String, _ password:String) -> LoginResult
}

struct LoginValidateModel: ValidatedModelType {
    func validatedMobile(_ mobile: String) -> Bool {
        
        return true
    }
    
    func validatePassword(_ password:String) -> Bool {
        
        return true
    }
    
    func login(_ mobile:String, _ password:String) -> LoginResult {
        
        return .success
    }
}


